package com.hzw.saas.web.shell.listener;

import com.hzw.saas.web.shell.event.DeleteSessionEvent;
import com.hzw.saas.web.shell.util.JschEnhanceUtil;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * @author zzl
 * @since 06/08/2021
 */
@Component
@RequiredArgsConstructor
@Order(1)
@Slf4j
public class SessionStatusListener {

    @EventListener(DeleteSessionEvent.class)
    public void deleteSession(DeleteSessionEvent event) {
        JschEnhanceUtil.closeSession(event.getSessionKey());
    }

}
